package com.briup.app02.web.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.briup.app02.bean.Category;
import com.briup.app02.service.ICategoryService;

@RestController
@RequestMapping("/category")
public class CategoryController {
	
	@Autowired
	private ICategoryService categoryService;
	
	@GetMapping("findAll")
	public List<Category> findAll(){
		return categoryService.findAll();
	}
	
	@GetMapping("findById")
	public Category findById(long id) {
		return categoryService.findById(id);
	}
	
	@GetMapping("saveOrUpdate")
	public String saveOrUpdate(Category category) {
		categoryService.saveOrUpdate(category);
		return "操作成功";
	}
}







